package com.goodving.guli.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.goodving.guli.R;
import com.goodving.guli.bt.C0668a;
import com.goodving.guli.bt.Utils;
import com.goodving.guli.model.Keeper;
import com.goodving.guli.view.C3247b;

/**
 * Created by john on 2015/11/26.
 */
public class DeviceNotFoundActivity extends SystemBarTintActivity implements OnClickListener {
    private String f3600a;
    private Context f3601b;

    public DeviceNotFoundActivity() {
        this.f3601b = this;
    }

    private boolean m8154a() {
        return Utils.f3495c.equals(this.f3600a) || Utils.f3496d.equals(this.f3600a);
    }

    public void onBackPressed() {
        C3247b.m22928a((Context) this, (int) R.string.search_again, 0).show();
        setResult(0);
        finish();
    }

    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.donot_bind_txt:
                Keeper.keepNeedBind(0);
                startActivity(new Intent(this, MainFragmentActivity.class));
                finish();
                C0668a.m8128a(this.f3601b, C0668a.ga, C0668a.gc);
//            case R.id.bracelet_not_found_get_help:
//                intent = new Intent(this, HelpActivity.class);
//                intent.putExtra(Utils.f3493a, this.f3600a);
//                startActivity(intent);
//                C0668a.m8128a(this.f3601b, C0668a.gb, C0668a.gc);
//            case R.id.bracelet_not_found_search_again:
//                intent = new Intent(this, SearchSingleBraceletActivity.class);
//                if (Utils.f3494b.equals(this.f3600a)) {
//                    intent.setClass(this, SearchSingleBraceletActivity.class);
//                } else if (m8154a()) {
//                    intent.setClass(this, SearchWeightScaleActivity.class);
//                    C0668a.m8128a(this.f3601b, C0668a.fZ, C0668a.gc);
//                }
//                startActivity(intent);
//                finish();
            default:
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView((int) R.layout.bracelet_not_found);
        ((Button) findViewById(R.id.bracelet_not_found_search_again)).setOnClickListener(this);
        findViewById(R.id.bracelet_not_found_get_help).setOnClickListener(this);
        TextView textView = (TextView) findViewById(R.id.donot_bind_txt);
        textView.setText(Html.fromHtml("<u>" + getString(R.string.donot_bind) + "</u>"));
        textView.setOnClickListener(this);
        textView = (TextView) findViewById(R.id.multi_devices_err_title);
        TextView textView2 = (TextView) findViewById(R.id.bracelet_not_found_info);
//        LinePieChartView linePieChartView = (LinePieChartView) findViewById(R.id.searching_pie_chart);
        Intent intent = getIntent();
        if (intent != null) {
            this.f3600a = intent.getStringExtra(Utils.f3493a);
            if (m8154a()) {
                textView.setText(R.string.weight_not_found_title);
                textView2.setText(R.string.weight_not_found_info);
//                linePieChartView.setMode(3);
            } else if (Utils.f3494b.equals(this.f3600a)) {
                textView.setText(R.string.bracelet_not_found_title);
                textView2.setText(R.string.bracelet_not_found_info);
//                linePieChartView.setMode(0);
            }
        }
    }

    protected void onPause() {
        super.onPause();
        C0668a.m8141b(C0668a.f3576s);
        C0668a.m8138b((Activity) this);
    }

    protected void onResume() {
        super.onResume();
        C0668a.m8133a(C0668a.f3576s);
        C0668a.m8124a((Activity) this);
    }
}
